PROJECT(VTKEXPAT)
INCLUDE_REGULAR_EXPRESSION("^(expat|xml|ascii|utf|name|iascii|latin|vtk).*$")

SET(expat_SRCS
  xmlparse.c
  xmltok.c
  xmlrole.c
)

INCLUDE_DIRECTORIES(${VTKEXPAT_SOURCE_DIR})

IF(WIN32)
  IF(NOT BUILD_SHARED_LIBS)
    SET (VTK_EXPAT_STATIC 1)
  ENDIF(NOT BUILD_SHARED_LIBS)
ENDIF(WIN32)

CONFIGURE_FILE(${VTKEXPAT_SOURCE_DIR}/expatConfig.h.in
               ${VTKEXPAT_BINARY_DIR}/expatConfig.h)
CONFIGURE_FILE(${VTKEXPAT_SOURCE_DIR}/expatDllConfig.h.in
               ${VTKEXPAT_BINARY_DIR}/expatDllConfig.h)
CONFIGURE_FILE(${VTKEXPAT_SOURCE_DIR}/.NoDartCoverage
               ${VTKEXPAT_BINARY_DIR}/.NoDartCoverage)

VTK_ADD_LIBRARY(vtkexpat ${expat_SRCS})

# Apply user-defined properties to the library target.
IF(VTK_LIBRARY_PROPERTIES)
  SET_TARGET_PROPERTIES(vtkexpat PROPERTIES ${VTK_LIBRARY_PROPERTIES})
ENDIF(VTK_LIBRARY_PROPERTIES)

IF(NOT VTK_INSTALL_NO_LIBRARIES)
  INSTALL(TARGETS vtkexpat
    EXPORT ${VTK_INSTALL_EXPORT_NAME}
    RUNTIME DESTINATION ${VTK_INSTALL_BIN_DIR_CM24} COMPONENT RuntimeLibraries
    LIBRARY DESTINATION ${VTK_INSTALL_LIB_DIR_CM24} COMPONENT RuntimeLibraries
    ARCHIVE DESTINATION ${VTK_INSTALL_LIB_DIR_CM24} COMPONENT Development)
ENDIF(NOT VTK_INSTALL_NO_LIBRARIES)
IF(NOT VTK_INSTALL_NO_DEVELOPMENT)
  INSTALL(FILES
    ${VTKEXPAT_BINARY_DIR}/expatDllConfig.h
    ${VTKEXPAT_SOURCE_DIR}/expat.h
    ${VTKEXPAT_SOURCE_DIR}/vtk_expat_mangle.h
    DESTINATION ${VTK_INSTALL_INCLUDE_DIR_CM24}/vtkexpat
    COMPONENT Development)
ENDIF(NOT VTK_INSTALL_NO_DEVELOPMENT)
